import globals from "globals";
import { defineConfig } from "eslint/config";
import pluginJs from "@eslint/js";
import pluginVue from "eslint-plugin-vue";
import eslintConfigPrettier from "eslint-config-prettier";
// import unocss from "@unocss/eslint-config/flat";
import typescriptEslint from "typescript-eslint";
import vueEslintParser from "vue-eslint-parser";

export default defineConfig([
  {
    ignores: ["**/*.d.ts", "**/dist/**"],

    files: ["**/*.{js,mjs,cjs,vue,jsx,ts,tsx}"],
    extends: [
      pluginJs.configs.recommended,
      pluginVue.configs["flat/essential"],
      typescriptEslint.configs.recommended,
      // unocss.plugins.unocss.rules,
      eslintConfigPrettier,
    ],
    languageOptions: {
      globals: {
        ...globals.browser,
      },
      ecmaVersion: "latest",
      sourceType: "module",
      parser: vueEslintParser,
      parserOptions: {
        parser: typescriptEslint.parser,

        ecmaFeatures: {
          jsx: true,
        },
      },
    },
    rules: {
      "no-undef": 0,
      "no-unused-vars": 0,
      "vue/multi-word-component-names": 0,
      "prefer-const": "warn",
      "@typescript-eslint/no-explicit-any": "error",
      "@typescript-eslint/no-unused-vars": [
        "warn",
        { argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
      ],
    },
  },
  // 类型不兼容
  // unocss as any,
]);
